{% extends 'base.html' %}

{% block title %}年级日程列表{% endblock %}

{% block content %}
<div class="container mt-4">
    <div class="row">
        <div class="col-md-12">
            <h1 class="mb-4">年级日程列表</h1>
            <a href="{% url 'core:grade_schedule_create' %}" class="btn btn-primary mb-3">添加年级日程</a>
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>年级</th>
                        <th>学期</th>
                        <th>日期</th>
                        <th>是否上课</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {% for schedule in schedules %}
                    <tr>
                        <td>{{ schedule.id }}</td>
                        <td>{{ schedule.grade.name }}</td>
                        <td>{{ schedule.semester.name }}</td>
                        <td>{{ schedule.date }}</td>
                        <td>{{ schedule.get_is_class_day_display }}</td>
                        <td>
                            <a href="{% url 'core:grade_schedule_detail' schedule.id %}" class="btn btn-info btn-sm">查看</a>
                            <a href="{% url 'core:grade_schedule_update' schedule.id %}" class="btn btn-warning btn-sm">编辑</a>
                            <a href="{% url 'core:grade_schedule_delete' schedule.id %}" class="btn btn-danger btn-sm">删除</a>
                        </td>
                    </tr>
                    {% empty %}
                    <tr>
                        <td colspan="6" class="text-center">暂无年级日程数据</td>
                    </tr>
                    {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}